//自定义封装按钮
import 'package:flutter/material.dart';

class PrimayButton extends StatelessWidget {
  final String text;
  final onPressed;
  final double width;
  final double height;
  final Color colors;
  final Color containercolor;
   Color textcolor = Colors.white;
   Color bordercolor ;
   double borderwidth = 1;
  
  PrimayButton({Key key, this.text, this.onPressed, this.width, this.height,this.colors,this.textcolor,this.bordercolor,this.borderwidth,this.containercolor})
      : super(key: key);
  

  @override
  Widget build(BuildContext context) {
    return new Container(
      width: this.width,
      height: this.height,
      child: new Material(
        // color:colors,
        color: containercolor,
        //INK可以实现装饰容器
        child: new Ink(
          //用ink圆角矩形
          // color: Colors.red,
          decoration: new BoxDecoration(
            //背景
            color: colors,
            //设置四周圆角 角度
            borderRadius: BorderRadius.all(Radius.circular(this.height / 2)),
            //设置四周边框
            border: new Border.all(
                width: borderwidth, color: bordercolor),
          ),
          child: new InkWell(
              //圆角设置,给水波纹也设置同样的圆角
              //如果这里不设置就会出现矩形的水波纹效果
              borderRadius: new BorderRadius.circular(15.0),

              //设置点击事件回调
              onTap: this.onPressed,
              child: Container(
                //设置 child 居中
                alignment: Alignment(0, 0),
                height: height,
                width: double.infinity,
                //color: Color.fromRGBO(27, 182, 251, 1),
                child: Text(
                  text,
                  style: TextStyle(color: textcolor),
                ),
              )),
        ),
      ),
    );
  }
}
